﻿<!-- Copyright © LECO Corporation 2013.  All Rights Reserved. -->

<UserControl x:Class="CornerstoneRemoteControlClient.Views.DeletableParameterWithFieldsView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:views="clr-namespace:CornerstoneRemoteControlClient.Views"
             xmlns:viewModels="clr-namespace:CornerstoneRemoteControlClient.ViewModels"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>

        <DataTemplate DataType="{x:Type viewModels:BooleanAttributeParameter}">
            <views:BooleanAttributeParameterView/>
        </DataTemplate>
        <DataTemplate DataType="{x:Type viewModels:AttributeParameter}">
            <views:AttributeParameterView/>
        </DataTemplate>

    </UserControl.Resources>

    <Grid Margin="5">
        <Border CornerRadius="10" Background="Bisque" BorderBrush="DarkGray" BorderThickness="1"/>


        <Button Width="20" Height="20" Style="{StaticResource CircleButton}" Margin="5,5" Command="{Binding DeleteReplicateParameterCommand}" Background="Red" HorizontalAlignment="Right" VerticalAlignment="Top">
            <Button.Content>
                <TextBlock Text="x" FontWeight="Bold" FontSize="20" Margin="1,-7,0,0"/>
            </Button.Content>
        </Button>
        
        <StackPanel>
            <ItemsControl ItemsSource="{Binding Parameters.ObservableCollection}">
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <ContentControl Content="{Binding}" Margin="10,5"/>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>

            <StackPanel Margin="10,5,0,5" Orientation="Horizontal">
                <TextBlock Text="Fields:" Style="{StaticResource HeaderText16}" VerticalAlignment="Center"/>
                <Button Width="20" Height="20" Style="{StaticResource CircleButton}" Margin="10,0" Command="{Binding AddFieldCommand}">
                    <Button.Content>
                        <TextBlock Text="+" FontWeight="Bold" FontSize="20" Margin="0,-6,0,0"/>
                    </Button.Content>
                </Button>
            </StackPanel>
            
            <ScrollViewer VerticalScrollBarVisibility="Auto" MaxHeight="75" Margin="10,5,40,5">
                <ItemsControl ItemsSource="{Binding Fields.ObservableCollection}">
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <views:FieldView Margin="0,4"/>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
            </ScrollViewer>

        </StackPanel>
    </Grid>
</UserControl>
